package com.jxt.myjxtmanager.db;

import android.database.sqlite.SQLiteDatabase;

import com.jxt.myjxtmanager.db.dao.Message_TaskDao;
import com.jxt.myjxtmanager.db.dao.SaleUserDao;
import com.jxt.myjxtmanager.db.dao.StudentDao;
import com.jxt.myjxtmanager.db.dao.SubjectDao;

import java.util.Map;

import de.greenrobot.dao.AbstractDao;
import de.greenrobot.dao.AbstractDaoSession;
import de.greenrobot.dao.identityscope.IdentityScopeType;
import de.greenrobot.dao.internal.DaoConfig;


// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.

/**
 * {@inheritDoc}
 *
 * @see AbstractDaoSession
 */
public class DaoSession extends AbstractDaoSession {

    private final SaleUserDao saleUserDao;
    private final DaoConfig saleUserDaoConfig;

    private final Message_TaskDao messageTaskDao;
    private final DaoConfig messageTaskDaoConfig;

    private final StudentDao studentDao;
    private final DaoConfig studentDaoConfig;
    private final SubjectDao subjectDao;
    private final DaoConfig subjectDaoConfig;


    public DaoSession(SQLiteDatabase db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig>
            daoConfigMap) {
        super(db);

        saleUserDaoConfig = daoConfigMap.get(SaleUserDao.class).clone();
        saleUserDaoConfig.initIdentityScope(type);

        messageTaskDaoConfig = daoConfigMap.get(Message_TaskDao.class).clone();
        messageTaskDaoConfig.initIdentityScope(type);

        studentDaoConfig = daoConfigMap.get(StudentDao.class).clone();
        studentDaoConfig.initIdentityScope(type);

        subjectDaoConfig = daoConfigMap.get(SubjectDao.class).clone();
        subjectDaoConfig.initIdentityScope(type);

        saleUserDao = new SaleUserDao(saleUserDaoConfig, this);
        messageTaskDao = new Message_TaskDao(messageTaskDaoConfig, this);
        studentDao = new StudentDao(studentDaoConfig, this);
        subjectDao = new SubjectDao(subjectDaoConfig, this);

        registerDao(SaleUser.class, saleUserDao);
        registerDao(Message_task.class, messageTaskDao);
        registerDao(Student.class, studentDao);
        registerDao(Subject.class,subjectDao);
    }

    public void clear() {
        saleUserDaoConfig.getIdentityScope().clear();
        messageTaskDaoConfig.getIdentityScope().clear();
        studentDaoConfig.getIdentityScope().clear();
        subjectDaoConfig.getIdentityScope().clear();
    }

    public StudentDao getStudentDao() {
        return studentDao;
    }

    public SaleUserDao getSaleUserDao() {
        return saleUserDao;
    }

    public Message_TaskDao getMessageTaskDao() {
        return messageTaskDao;
    }

    public SubjectDao getSubjectDao() {
        return subjectDao;
    }
}
